<?php
//URL: http://localhost/ChampChooser/core/services/player/playerBulkStatService.php?playerIds=5004
require_once ("../../config/config.php");
require_once ("../../config/constants.php");
require_once ("../../db/queries.php");
require_once ("../../common/common.php");

$playerIds= $_REQUEST["playerIds"];

function playerQuery($playerId) {
	$strQuery = "select * from stat where playerId='" . $playerId . "'";
	return generateResultSet($strQuery);
}
function makeStatsXML($playerIds) {
	echo XML_PROLOGUE . "\n ";
	echo "<records>" . NEWLINE;
	$playersList = split(',',$playerIds);
	for ( $index = 0, $max_count = sizeof( $playersList ); $index < $max_count; $index++ ) {
		$result = playerQuery($playersList[$index]);
		if (!$result) {
			die("Something is Seriously wrong!!!!");
		} else {
			echo "<stat>".NEWLINE;
			makePlayerStatsXML($result) ;
			echo "</stat>".NEWLINE;
			
		}
	}
	
	echo NEWLINE . "<resultsize>" . $index . "</resultsize>";
	echo "\n" . "</records>";
}
makeStatsXML($playerIds);

?>